package com.lxhotel.agentmcp.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lxhotel.agentmcp.entity.HotelRoomTypeInventory;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;

/**
 * This class function is xxx.
 *
 * @author yangbo
 * @date 2025/09/29
 */
@Mapper
public interface HotelRoomTypeInventoryMapper extends BaseMapper<HotelRoomTypeInventory> {
    @Select("SELECT * FROM hotel_room_type_inventory WHERE hotelRoomTypeId = #{hotelRoomTypeId} and bookingDate = #{bookingDate}")
    HotelRoomTypeInventory getHotelRoomTypeInventory(Long hotelRoomTypeId, Date bookingDate);

    @Update("UPDATE hotel_room_type_inventory SET num = num - 1 WHERE id = #{id}")
    void updateInventory(Long id);
}
